package com.example.springsecuritydemo.costant;

/**
 * 存放返回结果的统一code码
 *
 * @author chenggang
 */
public enum ResultCode {

    UN_AUTHORIZED_ACCESS(403, "您的权限不足，无法访问该资源!"),

    SUCCESS(1000, "成功"),
    FAIL(1001, "失败"),
    NOT_LOGIN(1002, "请您先登录"),
    
    USERNAME_NOT_FOUND(2001, "用户名不存在,用户名为[%s]"),
    USERNAME_NOT_EXIST(2002, "用户名不存在"),
    PASSWORD_ERROR(2003, "密码不正确"),
    //商家手机验证的
    SMS_CODE_EXPIRE(2005, "手机验证码已经失效!"),
    SMS_CODE_ERROR(2006, "对不起，您的验证码不正确!"),
    NOT_FOUNT_MERCHANT(2007, "未找到商家认证信息!"),
    NO_REPEAT_MASSAGE(1005, "一分钟不能发送重复短信"),
    ;

    private int code;
    private String message;

    ResultCode(int code, String message) {
        this.code = code;
        this.message = message;
    }

    public String format(String... args) {
        return String.format(this.message, args);
    }

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }
}
